package com.wind.cloud.demo.feign.factory;

import com.wind.cloud.demo.feign.HelloFeignService;
import com.wind.cloud.demo.feign.fallback.HelloFeignServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class HelloFeignServiceFactory implements FallbackFactory<HelloFeignService> {
    @Override
    public HelloFeignService create(Throwable throwable) {
        HelloFeignServiceFallbackImpl helloFeignServiceFallback = new HelloFeignServiceFallbackImpl();
        helloFeignServiceFallback.setCause(throwable);
        return helloFeignServiceFallback;
    }
}
